home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 10.7 KB | 425 lines | [TEXT/MPS ] |
- /* Copyright © 1986-1990 by Apple Computer, Inc. All rights reserved. */
-
- /* • Auto-Include the requirements for this source */
- #ifndef __TYPES.R__
- #include "Types.r"
- #endif
-
- #ifndef __MacAppTypes__
- #include "MacAppTypes.r"
- #endif
-
- #if qTemplateViews
- #ifndef __ViewTypes__
- #include "ViewTypes.r"
- #endif
- #endif
-
- #if qDebug
- include "Debug.rsrc";
- #endif
- include "MacApp.rsrc";
- include "Printing.rsrc";
-
- include $$Shell("ObjApp")"DemoText" 'CODE';
-
-
- /* Resource ids */
-
- #define kFileTooBig 1000 /* The 'File is too large' alert */
- #define kWindowRsrcID 1004
- #define kViewRsrcID 1005
-
- #define kPromptsRsrcID 1005 /* STR# resource containing prompts */
-
- #define mStyle 8 /* Hierarchical sub-menus */
- #define mSize 9
- #define mFont 10
- #define mColor 11
- #define hmStyle "\0x08" /* Byte values of hierarchical menu ids */
- #define hmSize "\0x09"
- #define hmFont "\0x0A"
- #define hmColor "\0x0B"
-
- #define kHierDisplayedMBar 131 /* MenuBar on hierarchical menu system */
-
- /* Command numbers */
-
- #define cWidthFrame 601 /* View-width-determination commands */
- #define cWidthView 602
- #define cWidthOnePage 603
-
- #define cHeightFrame 604 /* View-height-determination commands */
- #define cHeightPages 605
- #define cHeightText 606
- #define cHeightConst 607
-
- #define cJustLeft 608 /* Justification commands */
- #define cJustCenter 609
- #define cJustRight 610
-
- #define cPlainText 1001 /* Typestyle attributes */
- #define cBold 1002
- #define cItalic 1003
- #define cUnderline 1004
- #define cOutline 1005
- #define cShadow 1006
- #define cCondense 1007
- #define cExtend 1008
-
- #define cSizeChange 1100 /* Font-size commands */
- #define cSizeBase 1100
- #define cSizeMin 1109
- #define cSizeMax 1124
- #define cSizeGrow 1198
- #define cSizeShrink 1199
-
- #define cJustChange 1200 /* Command numbers to cover other stylistic changes */
- #define cFontChange 1300
-
- #define cStyle 1401 /* Command numbers for the hierarchial menu */
- #define cSize 1402
- #define cFont 1403
- #define cColor 1404
-
- #define cColorChange 1500 /* Command numbers for changing colors */
- #define cColorText 1501
- #define cColorBackground 1502
-
- #define kSignature 'SS04' /* Application signature */
-
- resource 'view' (kWindowRsrcID, purgeable) { {
- root, 'WIND', { 50, 40 }, { 250, 450 }, sizeVariable, sizeVariable, shown, enabled,
- Window {
- "",
- zoomDocProc, goAwayBox, resizable, modeless, ignoreFirstClick, freeOnClosing,
- disposeOnFree, closesDocument, openWithDocument, dontAdaptToScreen, stagger,
- forceOnScreen, dontCenter, 'TEVW', "" };
-
- 'WIND', 'SCLR', { 0, 0 }, { 250-kSBarSizeMinus1, 450-kSBarSizeMinus1 },
- sizeRelSuperView, sizeRelSuperView, shown, enabled,
- Scroller {
- "",
- vertScrollBar, horzScrollBar, 0, 0, 16, 16,
- vertConstrain, horzConstrain, { 0, 0, 0, 0 } };
-
- 'SCLR', IncludeViews { kViewRsrcID }
- } };
-
-
- resource 'view' (kViewRsrcID, purgeable) {{
- root, 'TEVW', { 0, 0 }, { 116, 1020 }, sizeVariable, sizePage, shown, enabled,
- TEView {
- "",
- withStyle, autoWrap, acceptChanges, dontFreeText, cTyping, unlimited,
- { 8, 10, 0, 10 }, justLeft, applFont12 }
- } };
-
-
- resource 'STR#' (kPromptsRsrcID, purgeable) {
- {
- /* [ 1] */ "Select a new text color…",
- /* [ 2] */ "Select background color…"
- }
- };
-
- resource 'SIZE' (-1) {
- saveScreen,
- acceptSuspendResumeEvents,
- enableOptionSwitch,
- canBackground,
- MultiFinderAware,
- backgroundAndForeground,
- dontGetFrontClicks,
- ignoreChildDiedEvents,
- is32BitCompatible,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- #if qdebug
- 450 * 1024,
- 368 * 1024
- #else
- 300 * 1024,
- 200 * 1024
- #endif
- };
-
- /* Printing to the LaserWriter is the time when the most temporary memory
- is in use. We need the segments in use at that time */
-
- resource 'seg!' (256, purgeable) {
- {
- "GWriteFile";
- "GClipboard";
- "GNonRes";
- "GFile";
- "GSelCommand";
- "GTerminate";
- "GClose";
- "GDoCommand";
- }
- };
-
- resource 'DITL' (phAboutApp, purgeable) {
- {
- /* [ 1] */ {160, 182, 180, 262},
- Button {
- enabled,
- "OK"
- };
- /* [ 2] */ {10, 75, 150, 320},
- StaticText {
- disabled,
- "This sample program demonstrates how to use various features of "
- "the “TEView” building block of MacApp.\n\nThis program was written "
- "with MacApp® © 1985-1990 Apple Computer, Inc."
- };
- /* [ 3] */ {10, 20, 42, 52},
- Icon {
- disabled,
- 1
- }
- }
- };
-
- include "Defaults.rsrc" 'ALRT' (phAboutApp); // Grab the default about box
-
- /* Used when the user attempts to read a file larger than we can handle */
-
- resource 'DITL' (kFileTooBig, purgeable) {
- {
- /* [ 1] */ {82, 198, 100, 272},
- Button {
- enabled,
- "OK"
- };
- /* [ 2] */ {10, 70, 77, 272},
- StaticText {
- disabled,
- "DemoText can’t read the entire file because it is too long."
- };
- /* [ 3] */ {10, 20, 42, 52},
- Icon {
- disabled,
- 0
- }
- }
- };
-
- resource 'ALRT' (kFileTooBig, purgeable) {
- {100, 110, 210, 402},
- kFileTooBig,
- {
- /* [ 1] */ OK, visible, silent;
- /* [ 2] */ OK, visible, silent;
- /* [ 3] */ OK, visible, silent;
- /* [ 4] */ OK, visible, silent
- }
- };
-
- include "Defaults.rsrc" 'cmnu' (mApple); // Grab the default Apple/File menus
- include "Defaults.rsrc" 'cmnu' (mFile);
-
- resource 'cmnu' (mEdit) {
- mEdit,
- textMenuProc,
- AllEnabled,
- enabled,
- "Edit",
- {
- /* [ 1] */ "Undo", noIcon, "Z", noMark, plain, cUndo;
- /* [ 2] */ "-", noIcon, noKey, noMark, plain, nocommand;
- /* [ 3] */ "Cut", noIcon, "X", noMark, plain, cCut;
- /* [ 4] */ "Copy", noIcon, "C", noMark, plain, cCopy;
- /* [ 5] */ "Paste", noIcon, "V", noMark, plain, cPaste;
- /* [ 6] */ "Clear", noIcon, noKey, noMark, plain, cClear;
- /* [ 7] */ "-", noIcon, noKey, noMark, plain, nocommand;
- /* [ 8] */ "Select All", noIcon, "A", noMark, plain, cSelectAll;
- /* [ 9] */ "-", noIcon, noKey, noMark, plain, nocommand;
- /* [10] */ "Show Clipboard", noIcon, noKey, noMark, plain, cShowClipboard;
- /* [11] */ "-", noIcon, noKey, noMark, plain, nocommand;
- /* [12] */ "Show Page Breaks", noIcon, noKey, noMark, plain, cShowBreaks
- }
- };
-
- resource 'cmnu' (5) {
- 5,
- textMenuProc,
- AllEnabled,
- enabled,
- "Text",
- {
- /* [ 1] */ "View as wide as frame",
- noIcon, noKey, noMark, plain, cWidthFrame;
- /* [ 2] */ "View width frozen",
- noIcon, noKey, noMark, plain, cWidthView;
- /* [ 3] */ "View as wide as one page",
- noIcon, noKey, noMark, plain, cWidthOnePage;
- /* [ 4] */ "-", noIcon, noKey, noMark, plain, nocommand;
- /* [ 5] */ "View as high as the frame",
- noIcon, noKey, noMark, plain, cHeightFrame;
- /* [ 6] */ "View height an exact number of pages",
- noIcon, noKey, noMark, plain, cHeightPages;
- /* [ 7] */ "View as high as its content",
- noIcon, noKey, noMark, plain, cHeightText;
- /* [ 8] */ "View height frozen",
- noIcon, noKey, noMark, plain, cHeightConst;
- /* [ 9] */ "-", noIcon, noKey, noMark, plain, nocommand;
- /* [10] */ "Left justified", noIcon, noKey, noMark, plain, cJustLeft;
- /* [11] */ "Center justified", noIcon, noKey, noMark, plain, cJustCenter;
- /* [12] */ "Right justified", noIcon, noKey, noMark, plain, cJustRight
- }
- };
-
- /* Hierarchical Format menu with Style, Size and Font submenus */
- resource 'cmnu' (7) {
- 7,
- textMenuProc,
- allEnabled,
- enabled,
- "Format",
- {
- /* [ 1] */ "Style", noIcon, kHierarchicalMenu, hmStyle, plain, cStyle;
- /* [ 2] */ "Size", noIcon, kHierarchicalMenu, hmSize, plain, cSize;
- /* [ 3] */ "Font", noIcon, kHierarchicalMenu, hmFont, plain, cFont;
- /* [ 4] */ "Color", noIcon, kHierarchicalMenu, hmColor, plain, cColor
- }
- };
-
- /* Hierarchical Style Sub-menu */
- resource 'cmnu' (mStyle) {
- mStyle,
- textMenuProc,
- allEnabled,
- enabled,
- "Style",
- {
- /* [ 1] */ "Plain Text", noIcon, noKey, noMark, plain, cPlainText;
- /* [ 2] */ "Bold", noIcon, noKey, noMark, bold, cBold;
- /* [ 3] */ "Italic", noIcon, noKey, noMark, italic, cItalic;
- /* [ 4] */ "Underline", noIcon, noKey, noMark, underline, cUnderline;
- /* [ 5] */ "Outline", noIcon, noKey, noMark, outline, cOutline;
- /* [ 6] */ "Shadow", noIcon, noKey, noMark, shadow, cShadow;
- /* [ 7] */ "Condensed", noIcon, noKey, noMark, condense, cCondense;
- /* [ 8] */ "Extended", noIcon, noKey, noMark, extend, cExtend
- }
- };
-
- /* Hierarchical Size Sub-menu */
- resource 'cmnu' (mSize) {
- mSize,
- textMenuProc,
- AllEnabled,
- enabled,
- "Size",
- {
- /* [ 1] */ " 9 Point", noIcon, noKey, noMark, plain, cSizeBase+9;
- /* [ 2] */ "10 Point", noIcon, noKey, noMark, plain, cSizeBase+10;
- /* [ 3] */ "12 Point", noIcon, noKey, noMark, plain, cSizeBase+12;
- /* [ 4] */ "14 Point", noIcon, noKey, noMark, plain, cSizeBase+14;
- /* [ 5] */ "18 Point", noIcon, noKey, noMark, plain, cSizeBase+18;
- /* [ 6] */ "24 Point", noIcon, noKey, noMark, plain, cSizeBase+24;
- /* [ 7] */ "-", noIcon, noKey, noMark, plain, nocommand;
- /* [ 8] */ "Grow selection", noIcon, "]", noMark, plain, cSizeGrow;
- /* [ 9] */ "Shrink selection", noIcon, "[", noMark, plain, cSizeShrink
-
- }
- };
-
- /* Font menu for hierarchical or non-hierarchical system */
- resource 'MENU' (mFont) {
- mFont,
- textMenuProc,
- allEnabled,
- enabled,
- "Font",
- { }
- };
-
- resource 'cmnu' (mColor) {
- mColor,
- textMenuProc,
- allEnabled,
- enabled,
- "Color",
- {
- /* [ 1] */ "Set text color…", noIcon, "T", noMark, plain, cColorText;
- /* [ 2] */ "Set background color…",
- noIcon, "K", noMark, plain, cColorBackground
- }
- };
-
- resource 'cmnu' (mBuzzwords) {
- mBuzzwords,
- textMenuProc,
- allEnabled,
- enabled,
- "Buzzwords",
- {
- "Typing", noIcon, noKey, noMark, plain, cTyping;
- "Style Change", noIcon, noKey, noMark, plain, cStyleChange;
- "Size Change", noIcon, noKey, noMark, plain, cSizeChange;
- "Justification Change", noIcon, noKey, noMark, plain, cJustChange;
- "Font Change", noIcon, noKey, noMark, plain, cFontChange;
- "Color Change", noIcon, noKey, noMark, plain, cColorChange;
- "Page Setup Change", noIcon, noKey, noMark, plain, cChangePrinterStyle
- }
- };
-
- /* Displayed menus on a non-hierarchical system */
- resource 'MBAR' (kMBarDisplayed) {
- {mApple; mFile; mEdit; 5; 8; 9; 10; 11}
- };
-
- /* Displayed menus on a hierarchical system */
- resource 'MBAR' (kHierDisplayedMBar) {
- {mApple; mFile; mEdit; 5; 7}
- };
-
- /* Hierarchial Sub-Menus */
- resource 'MBAR' (kMBarHierarchical) {
- {8; 9; 10; 11}
- };
-
- include "Defaults.rsrc" 'STR#' (kDefaultCredits); // Grab the default credits
- resource 'BNDL' (128,
- #if qNames
- "DemoText",
- #endif
- purgeable) {
- kSignature,
- 0,
- {
- 'ICN#',
- {
- 0, 128,
- },
- 'FREF',
- {
- 0, 128,
- }
- }
- };
-
- type kSignature as 'STR ';
- resource kSignature (0,
- #if qNames
- "Signature",
- #endif
- purgeable) {
- "DemoText 2.0 ©Apple Computer, Inc. 1988-1990"
- };
-
- // Get the default MacApp® application icon and file reference
- include "Defaults.rsrc" 'ICN#' (128);
- include "Defaults.rsrc" 'FREF' (128);
-
- // Get the default Version resources
- include "Defaults.rsrc" 'vers' (1); // Application or file specific
- include "Defaults.rsrc" 'vers' (2); // Overall package
-